﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace WebApplication1
{
    public partial class WebForm3 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GridView1.DataSource = GetData();
                GridView1.DataBind();
            }
        }

        // 获取测试DataTable
        private DataTable GetData()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("id");
            dt.Columns.Add("name");
            dt.Columns.Add("age");

            DataRow row = null;

            row = dt.NewRow();
            row["id"] = 1;
            row["name"] = "昌龙";
            row["age"] = 25;
            dt.Rows.Add(row);

            row = dt.NewRow();
            row["id"] = 2;
            row["name"] = "破天";
            row["age"] = 23;
            dt.Rows.Add(row);

            row = dt.NewRow();
            row["id"] = 3;
            row["name"] = "牛皮";
            row["age"] = 28;
            dt.Rows.Add(row);

            return dt;
        }

        /// <summary>
        /// 弹出选择框
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnShowPop_Click(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message",
    "<script language='javascript' defer>$.popup.open('#GridView1');</script>");
        }

        /// <summary>
        /// 弹出提示框
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnShowMes_Click(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "message",
    "<script language='javascript' defer>$.popup.open('没钱买我想要的本本，穷啊。。。能在买台台机也不错啊。。。');</script>");
        }

        /// <summary>
        /// 选择某个人
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void sel(object sender, EventArgs e)
        {
            string id = (sender as LinkButton).CommandArgument;
            Response.Write("您选择的ID是：" + id);
        }


    }
}